package com.fita.admin.service.data.impl;

import com.demo2do.core.persistence.annotation.Dao;
import com.fita.admin.dao.PaymentRequestDao;
import com.fita.admin.service.DataServiceImpl;
import com.fita.admin.service.data.PaymentRequestService;
import com.fita.entity.order.PaymentRequest;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 
 * @author sjh
 *
 */
@Service("paymentRequestService")
public class PaymentRequestServiceImpl extends DataServiceImpl<PaymentRequest> implements PaymentRequestService{
	
	@Dao
	private PaymentRequestDao paymentRequestDao;
	/*
	 * (non-Javadoc)
	 * @see com.fita.admin.service.data.PaymentRequestService#load(java.lang.String)
	 */
	public PaymentRequest load(String code) {
		return paymentRequestDao.load(code);
	}

	/**
	 * 根据订单号查询付款请求
	 *
	 * @param orderCode
	 * @return
	 */
	public PaymentRequest loadByOrderCode(String orderCode) {
		return paymentRequestDao.loadByOrderCode(orderCode);
	}

	/**
	 * @param orderCode
	 * @return
	 */
	public List<PaymentRequest> listByOrderCode(String orderCode) {

		List paymentRequests = genericDaoSupport.searchForList("FROM PaymentRequest WHERE disabled = false AND orderCode = :orderCode", "orderCode", orderCode);

		return paymentRequests;
	}

}
